package com.yst.webplugin.annotation;

import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;

@ResultType(resultTypes = {Boolean.class,Integer.class,Long.class})
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Command {
    /**
     * name of command, can use map of sql
     * @return
     */
    String name() default "";

    @AliasFor("name")
    String commandName() default "";

    /**
     * use executor as default,priority level more than name
     * @return
     */
    Class<? extends ICommand> executor() default ICommand.class;

    /**
     * class of valid
     * @return
     */
    Class<?> validClass() default Default.class;

    /**
     * group of valid
     * @return
     */
    Class<?>[] validClassGroup() default {};

    /**
     * batch execute command
     */
    @ResultType(resultTypes = {Boolean.class,Integer.class})
    @Target({ElementType.FIELD})
    @Retention(RetentionPolicy.RUNTIME)
    @interface BatchCommand{
        /**
         * command name
         * @return command name
         */
        String name() default"";

        /**
         * command array
         * @return command array
         */
        Command[] commands();
    }
}
